// 地图管理员
// 1.定义一个state默认值
const defaultState = {
    cityName: ""
}

export default (state = defaultState, action) => {
    // console.log(action);  //查看 操作是哪种操作
    // react-redux 
    // 深拷贝一份 state
    const newState = JSON.parse(JSON.stringify(state))
    switch (action.type) {
        case "setCityName":
            newState.cityName = action.value;
            return newState
            break;
        case "changeCityName":
            newState.cityName = action.value;
            return newState
            break;
        default:
            break;
    }
    return state;
}